package com.pureut.storage.service;


import com.baomidou.mybatisplus.extension.service.IService;
import com.pureut.storage.domain.PickingSale;
import com.pureut.storage.dto.*;
import com.pureut.storage.vo.*;
import com.sale.common.core.domain.R;
import com.sale.common.mybatis.core.page.PageQuery;
import com.sale.common.mybatis.core.page.TableDataInfo;
import com.sale.storage.api.vo.InvoiceVo;

import java.util.List;

/**
 * 销售发货Service
 * @author: CM
 * @date: 2023/7/17    11:31
 */
public interface PickingSaleService extends IService<PickingSale> {

    /**
     * 新增销售发货
     * @param pickingSaleVo
     * @return
     */
    boolean addSale(PickingSaleVo pickingSaleVo) throws Exception;

    /**
     * 修改销售发货
     * @param pickingSaleVo
     * @return
     */
    boolean updateSale(PickingSaleVo pickingSaleVo);

    /**
     * 关结单据
     * @param pickingSaleVo
     * @return
     */
    boolean closeSale(PickingSaleVo pickingSaleVo);

    /**
     * 删除单据
     * @param ids
     * @return
     */
    boolean deleteSale(String ids);

    /**
     * 提交审核
     * @param ids
     * @return
     */
    boolean submitSale(String ids);

    /**
     * 销售发货列表
     * @param pickingSaleVo
     * @param pageQuery
     * @return
     */
    TableDataInfo<PickingSaleDto> getList(PickingSaleVo pickingSaleVo, PageQuery pageQuery) throws Exception;

    /**
     * 审核单据
     * @param orderReviewVo
     * @return
     */
    boolean saleReview(OrderReviewVo orderReviewVo) throws Exception;

    /**
     * 查看单据
     * @param id
     * @return
     */
    PickingSaleDto view(Long id);

    /**
     * 撤销审核
     * @param ids
     * @return
     */
    boolean revoke(String ids);

    /**
     * 拣货方案
     * @param id
     * @return
     */
    SchemeDto point(Long id);

    /**
     * 销售发货出库
     * @param pickingRestDbVo
     * @return
     */
    PickingRestDbDto out(PickingRestDbVo pickingRestDbVo);

    /**
     * 销售发货列表（不分页）
     */
    List<PickingSaleDto> noPageList(PickingSaleVo pickingSaleVo);

    /**
     * 拣货完成
     * @param id
     * @return
     */
    boolean finishProduction(Long id);

    /**
     * 拣货撤销
     * @param id
     * @return
     */
    boolean repealProduction(Long id);

    /**
     * 交接
     * @param pickingRestDbVo
     * @return
     */
    PickingRestHandoverDto overProduction(PickingRestDbVo pickingRestDbVo);

    /**
     * 销售发票根据单据类型查询列表
     * @param
     * @return
     */
    TableDataInfo<SaleInvoiceDto> getSaleInvoice(SaleInvoiceVo saleInvoiceVo, PageQuery pageQuery);

    /**
     * 销售发票列表
     * @param saleInvoiceVo
     * @param pageQuery
     * @return
     */
    TableDataInfo<SaleInvoiceDto> saleInvoicedList(SaleInvoiceVo saleInvoiceVo, PageQuery pageQuery);

    /**
     * 查询收款单和付款单需要的销售发货和采购退货列表
     */
    TableDataInfo<ReceiptAndPaymentDocDto> getReceiptAndPaymentDoc(ReceiptAndPaymentDocVo saleServiceVo, PageQuery pageQuery);

    /**
     * 修改核单金额，发票数量
     * @param list
     * @return
     */
    boolean updateStorage(List<InvoiceVo> list);

    /**
     * 通过客户编码获取总欠款数
     */
    String getBalance(String customerCode);


    /**
     *  财务-核销单 通过客户编码获取销售发货数据
      * @param getDataByCodeVo
     * @return
     */
    TableDataInfo<ImparityDto> getDataByCode(GetDataByCodeVo getDataByCodeVo,PageQuery pageQuery);

    /**
     * 新增销售发货(销售订单新增时使用)
     * @param pickingSaleVo
     * @return
     */
    boolean addSaleOrder(PickingSaleVo pickingSaleVo) throws Exception;

    /**
     * 财务-核销单 通过获取未全部核销的销售发货单、销售退货单、其他收入单数据
     */
    TableDataInfo<ImparityDto> getNoVerificationList(GetDataByCodeVo getDataByCodeVo, PageQuery pageQuery);
}
